package pers.fulsun.demo.springcloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.fulsun.demo.springcloud.entity.SysDataDictionary;
import pers.fulsun.demo.springcloud.service.SysDataDictionaryService;

import java.util.List;

@RestController
@RequestMapping("/sys-data-dictionary")
public class SysDataDictionaryController {

    private final String DEFAULT_DATABASE = "test";
    @Autowired
    private SysDataDictionaryService sysDataDictionaryService;

    @GetMapping("scan")
    public List<SysDataDictionary> scanDataTable() {
        //系统默认使用“test”数据库
        return this.sysDataDictionaryService.scanDataTable(DEFAULT_DATABASE);
    }

    @GetMapping("scanTable")
    public List<SysDataDictionary> scanDataTable(String table) {
        return this.sysDataDictionaryService.scanDataTable(DEFAULT_DATABASE, table);//系统默认使用“spring”数据库
    }
}